package com.ruoyi.ring.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ring.mapper.RingTrainingMapper;
import com.ruoyi.ring.domain.RingTraining;
import com.ruoyi.ring.service.IRingTrainingService;

/**
 * 训练Service业务层处理
 * 
 * @author liuwp
 * @date 2025-08-18
 */
@Service
public class RingTrainingServiceImpl implements IRingTrainingService 
{
    @Autowired
    private RingTrainingMapper ringTrainingMapper;

    /**
     * 查询训练
     * 
     * @param id 训练主键
     * @return 训练
     */
    @Override
    public RingTraining selectRingTrainingById(Long id)
    {
        return ringTrainingMapper.selectRingTrainingById(id);
    }

    /**
     * 查询训练列表
     * 
     * @param ringTraining 训练
     * @return 训练
     */
    @Override
    public List<RingTraining> selectRingTrainingList(RingTraining ringTraining)
    {
        return ringTrainingMapper.selectRingTrainingList(ringTraining);
    }

    /**
     * 根据业务主键查询一条记录：训练
     *
     * @param ringTraining 训练
     * @return 训练
     */
    @Override
    public RingTraining selectOneRingTraining(RingTraining ringTraining)
    {
        return ringTrainingMapper.selectOneRingTraining(ringTraining);
    }

    /**
     * 新增训练
     * 
     * @param ringTraining 训练
     * @return 结果
     */
    @Override
    public int insertRingTraining(RingTraining ringTraining)
    {
        ringTraining.setCreateTime(DateUtils.getNowDate());
        return ringTrainingMapper.insertRingTraining(ringTraining);
    }

    /**
     * 修改训练
     * 
     * @param ringTraining 训练
     * @return 结果
     */
    @Override
    public int updateRingTraining(RingTraining ringTraining)
    {
        ringTraining.setUpdateTime(DateUtils.getNowDate());
        return ringTrainingMapper.updateRingTraining(ringTraining);
    }

    @Override
    public int updateRingTrainingCondition(RingTraining ringTraining, RingTraining ringTrainingCondition)
    {
                ringTraining.setUpdateTime(DateUtils.getNowDate());
        return ringTrainingMapper.updateRingTrainingCondition(ringTraining, ringTrainingCondition);
    }

    /**
     * 批量删除训练
     * 
     * @param ids 需要删除的训练主键
     * @return 结果
     */
    @Override
    public int deleteRingTrainingByIds(Long[] ids)
    {
        return ringTrainingMapper.deleteRingTrainingByIds(ids);
    }

    /**
     * 删除训练信息
     * 
     * @param id 训练主键
     * @return 结果
     */
    @Override
    public int deleteRingTrainingById(Long id)
    {
        return ringTrainingMapper.deleteRingTrainingById(id);
    }

    /**
     * 条件删除训练
     *
     * @param ringTraining 训练
     * @return 结果
     */
    @Override
    public int deleteRingTrainingByCondition(RingTraining ringTraining)
    {
        return ringTrainingMapper.deleteRingTrainingByCondition(ringTraining);
    }

}
